/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package xmlresources;

import client.MonitorClient;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;

/**
 * REST Web Service
 *
 * @author JBP
 */
@Path("xml")
public class XmlResource {

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of XmlResource
     */
    public XmlResource() {
    }

    /**
     * Retrieves representation of an instance of traitement.XmlResource
     * @return an instance of java.lang.String
     */
    @GET
    @Produces("application/xml")
    public String getXml() {
        //TODO return proper representation object
        throw new UnsupportedOperationException();
    }

    @GET
    @Produces("application/xml")
    @Path("resultat")
    public MonitorClient getXmlRessources() throws NotBoundException, MalformedURLException, RemoteException {
        MonitorClient global = new MonitorClient();
        global.initialiser("127.0.0.1");
        
        global.getCpu();
        global.getMemory();
        global.getProcessus();

        return global;
    }
    
    /**
     * PUT method for updating or creating an instance of XmlResource
     * @param content representation for the resource
     * @return an HTTP response with content of the updated or created resource.
     */
    @PUT
    @Consumes("application/xml")
    public void putXml(String content) {
    }
    
    
    
    
}
